package thread;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.sql.SQLOutput;
import java.util.Scanner;

public class SleepDemo {
    public static void main(String[] args) {
        System.out.println("程序开始了");
        BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
        try {
            String line =br.readLine();
            int num=Integer.parseInt(line);
            for (int i = num; i >=0; i--) {
                System.out.println("等待"+i+"秒");
                Thread.sleep(1000);
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        Scanner sc=new Scanner(System.in);

        try {
            int a= sc.nextInt();
            for (int i = a; i >=0; i--) {
                System.out.println("等待"+i+"秒");
                Thread.sleep(1000);
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("程序结束了");
    }
}
